<!DOCTYPE html>
<html> <head>
    <meta charset="utf-8" />
    <title> progress元素的使用</title>
    <style type="text/css">
        input{
            border-radius: 10px;
        }
        progress{
            width:300px;
            height:20px;
            border-color:transparent;
            border-radius:10px;
            background:darkred;
        }
    </style>
</head>

<progress value="0" max="100" id="proDownFile"></progress>
<input type="button" id="btn" value="下载" onclick="Btn_Click();">

<script type="text/javascript">

    var intValue=0;
    var intTimer;
    var objPro=document.getElementById('proDownFile');
    var btn = document.getElementById('btn');
    //定时事件
    function Interval_handler(){
        intValue++;
        objPro.value=intValue;
        if(intValue>=objPro.max){
            clearInterval(intTimer);
            btn.value = "下载完成";

        }else{
            btn.value = "下载中("+intValue+"%)";
            btn.disabled = true;
        }
    }
    function Btn_Click(){
        intTimer=setInterval(Interval_handler,100);
    }

</script>
</body></html>
